package com.jbookshelf.dal.entities;
// Generated 22.12.2012 21:50:33 by Hibernate Tools 4.0.0

import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Orders generated by hbm2java
 */
@Entity
@Table(name = "ORDERS", schema = "PUBLIC", catalog = "PUBLIC")
public class Orders implements java.io.Serializable {

	private Integer id;
	private Users users;
	private OrderStatuses orderStatuses;
	private Shops shops;
	private String bookName;
	private String notes;
	private String bookUrl;
	private Set<OrdersHistory> ordersHistories = new HashSet<OrdersHistory>(0);

	public Orders() {
	}

	public Orders(String bookName) {
		this.bookName = bookName;
	}

	public Orders(Users users, OrderStatuses orderStatuses, Shops shops,
			String bookName, String notes, String bookUrl,
			Set<OrdersHistory> ordersHistories) {
		this.users = users;
		this.orderStatuses = orderStatuses;
		this.shops = shops;
		this.bookName = bookName;
		this.notes = notes;
		this.bookUrl = bookUrl;
		this.ordersHistories = ordersHistories;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "ID", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "CREATED_BY")
	public Users getUsers() {
		return this.users;
	}

	public void setUsers(Users users) {
		this.users = users;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "STATUS_ID")
	public OrderStatuses getOrderStatuses() {
		return this.orderStatuses;
	}

	public void setOrderStatuses(OrderStatuses orderStatuses) {
		this.orderStatuses = orderStatuses;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "SHOP_ID")
	public Shops getShops() {
		return this.shops;
	}

	public void setShops(Shops shops) {
		this.shops = shops;
	}

	@Column(name = "BOOK_NAME", nullable = false, length = 128)
	public String getBookName() {
		return this.bookName;
	}

	public void setBookName(String bookName) {
		this.bookName = bookName;
	}

	@Column(name = "NOTES", length = 512)
	public String getNotes() {
		return this.notes;
	}

	public void setNotes(String notes) {
		this.notes = notes;
	}

	@Column(name = "BOOK_URL", length = 128)
	public String getBookUrl() {
		return this.bookUrl;
	}

	public void setBookUrl(String bookUrl) {
		this.bookUrl = bookUrl;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "orders")
	public Set<OrdersHistory> getOrdersHistories() {
		return this.ordersHistories;
	}

	public void setOrdersHistories(Set<OrdersHistory> ordersHistories) {
		this.ordersHistories = ordersHistories;
	}

}
